﻿ 
namespace D.Domain.SystemDomain.SysUserDomain.Repositories
{
    /// <summary>
    /// 仓储接口
    /// </summary>
    public interface ISysUserRepository
    {
        /// <summary>
        /// 查找一个用户
        /// </summary>
        /// <param name="phoneNumberVo">手机号</param>
        /// <returns>一个用户/null</returns>
        Task<SysUserEntity?> FindOneAsync(PhoneNumberVo phoneNumberVo);

        /// <summary>
        /// 查找一个用户
        /// </summary>
        /// <param name="sysAdminId">用户住建</param>
        /// <returns>一个用户/null</returns>
        Task<SysUserEntity?> FindOneAsync(Guid sysAdminId);

        /// <summary>
        /// 添加登录历史
        /// </summary>
        /// <param name="phoneNumberVo">手机号</param>
        /// <param name="msg">内容</param>
        /// <returns></returns>
        Task AddLoginHistoryAsync(PhoneNumberVo phoneNumberVo, string msg); 

        /// <summary>
        /// 保存手机验证码
        /// </summary>
        /// <param name="phoneNumberVo">手机号</param>
        /// <param name="code">验证码</param>
        /// <returns></returns>
        Task SavePhoneCodeAsync(PhoneNumberVo phoneNumberVo, string code);

        /// <summary>
        /// 获取手机验证码
        /// </summary>
        /// <param name="phoneNumberVo">手机号</param>
        /// <returns></returns>
        Task<string?> RetrievePhoneCodeAsync(PhoneNumberVo phoneNumberVo);

        Task PublishEventAsync(SysUserLoginResultEvent sysAdminLoginResultEvent);
    }
}
